﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;

namespace WpfFootball.Parser
{
    public enum ViewKind
    {
        FORUM,
        FIXTURES,
        NEWS
    }

    /// <summary>
    /// A general object that contains a set of settings to be applied in a view.
    /// </summary>
    public class ViewSettings
    {
        /// <summary>
        /// Gets and sets the auto update flag.
        /// </summary>
        public bool AutoUpdate { get; set; }
        /// <summary>
        /// Gets and sets the updating frequency of the view.
        /// </summary>
        public int UpdateFrequency { get; set; }
        /// <summary>
        /// Gets and sets a value indicating how many entries the view must be capable to handle.
        /// </summary>
        public int EntryCounter { get; set; }
        /// <summary>
        /// Gets and sets the location of the view attached to this settings.
        /// </summary>
        public Point Location { get; set; }


        public ViewSettings(bool autoUpdate, int updateFrequency, int entryCounter, Nullable<Point> location = null)
        {
            AutoUpdate = autoUpdate;
            UpdateFrequency = updateFrequency;
            EntryCounter = entryCounter;
            Location = location.Value;
        }

        public ViewSettings()
        { }

        /// <summary>
        /// Gets the default settings of a specified view.
        /// </summary>
        /// <param name="viewKind">The kind of the view to get the default settings.</param>
        /// <returns>The default settings for the specified view.</returns>
        public static ViewSettings GetDefault(ViewKind viewKind)
        {

            switch (viewKind)
            {
                case ViewKind.FIXTURES:
                    return new ViewSettings(false, 10, 6, new Point(750, 100));
                case ViewKind.FORUM:
                    return new ViewSettings(false, 10, 6, new Point(20, 10));
                case ViewKind.NEWS:
                    return new ViewSettings(false, 10, 6, new Point(420, 250));
                default:
                    return new ViewSettings(false, 10, 6, null);
            }
        }
    }

}
